<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Decrypt a chunk of data from an encrypted stream</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.sodium-crypto-secretstream-xchacha20poly1305-keygen.html">« sodium_crypto_secretstream_xchacha20poly1305_keygen</a></li>
      <li style="float: right;"><a href="function.sodium-crypto-secretstream-xchacha20poly1305-push.html">sodium_crypto_secretstream_xchacha20poly1305_push »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.sodium.html">Sodium 函数</a></li>
    <li>Decrypt a chunk of data from an encrypted stream</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.sodium-crypto-secretstream-xchacha20poly1305-pull" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sodium_crypto_secretstream_xchacha20poly1305_pull</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0, PHP 8)</p><p class="refpurpose"><span class="refname">sodium_crypto_secretstream_xchacha20poly1305_pull</span> &mdash; <span class="dc-title">Decrypt a chunk of data from an encrypted stream</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sodium-crypto-secretstream-xchacha20poly1305-pull-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>sodium_crypto_secretstream_xchacha20poly1305_pull</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$state</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$ciphertext</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$additional_data</code><span class="initializer"> = &quot;&quot;</span></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   Decrypt a chunk of data from an encrypted stream.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.sodium-crypto-secretstream-xchacha20poly1305-pull-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">state</code></dt>

    <dd>

     <p class="para">
      See <span class="function"><a href="function.sodium-crypto-secretstream-xchacha20poly1305-init-pull.html" class="function">sodium_crypto_secretstream_xchacha20poly1305_init_pull()</a></span>
      and <span class="function"><a href="function.sodium-crypto-secretstream-xchacha20poly1305-init-push.html" class="function">sodium_crypto_secretstream_xchacha20poly1305_init_push()</a></span>
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">ciphertext</code></dt>

    <dd>

     <p class="para">
      The ciphertext chunk to decrypt.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">additional_data</code></dt>

    <dd>

     <p class="para">
      Optional additional data to include in the authentication tag.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sodium-crypto-secretstream-xchacha20poly1305-pull-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An array with two values:
   <ul class="itemizedlist">
    <li class="listitem">
     <p class="para">
      <span class="type">string</span>; The decrypted chunk
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      <span class="type">int</span>; An optional tag (if provided during push). Possible values:
      <ul class="simplelist">
       <li class="member">
        <strong><code>SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE</code></strong>:
        the most common tag, that doesn&#039;t add any information about the nature of the message.
       </li>
       <li class="member">
        <strong><code>SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL</code></strong>:
        indicates that the message marks the end of the stream, and erases the secret key used to encrypt the previous sequence.
       </li>
       <li class="member">
        <strong><code>SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH</code></strong>:
        indicates that the message marks the end of a set of messages, but not the end of the stream.
        For example, a huge JSON string sent as multiple chunks can use this tag to indicate to the application that the
        string is complete and that it can be decoded. But the stream itself is not closed, and more data may follow.
       </li>
       <li class="member">
        <strong><code>SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY</code></strong>:
        &quot;forget&quot; the key used to encrypt this message and the previous ones, and derive a new secret key.
       </li>
      </ul>
     </p>
    </li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>